/*
package com.zhaobenquan.batch;

import lombok.extern.slf4j.Slf4j;
import org.springframework.batch.core.Job;
import org.springframework.batch.core.JobExecution;
import org.springframework.batch.core.JobParametersBuilder;
import org.springframework.batch.core.launch.JobLauncher;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.UUID;

*/
/**
 * @author zhaobenquan
 * @Date 2021/7/2 11:45
 *//*

@Slf4j
@Component
public class SiteJobLauncher {
    @Autowired
    private JobLauncher jobLauncher;

    @Autowired
    private Job siteImportJob;

    public String launch(String path, String fileName, Long groupId) {
        JobParametersBuilder jobParametersBuilder = new JobParametersBuilder();
        String uuid = UUID.randomUUID().toString();
        jobParametersBuilder.addLong("groupId", groupId)
                .addString("rawFileName", fileName)
                .addString("uuid", uuid)
                .addString("ftpFileName", path);
        try {
            JobExecution execution = jobLauncher.run(siteImportJob, jobParametersBuilder.toJobParameters());
            log.info("Exit Status : " + execution.getStatus());
        } catch (Exception e) {
            throw new RuntimeException("异常出现了");
        }
        return uuid;
    }

}
*/
